package com.huoshan.im.server.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;

/**
 * IM用户模型
 *
 * @author: 火山九日
 * @since: 2020-11-10
 **/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class UserDto implements Serializable {

    public static final String APP = "app";
    private static final long serialVersionUID = 1L;
    /**
     * 对应数据库的userId
     */
    private Long userId;

    /**
     * app,miniapp（小程序）
     */
    private String clientType;

    @Override
    public String toString() {
        return userId + "-" + StringUtils.defaultIfEmpty(clientType, UserDto.APP).toLowerCase();
    }

}
